package com.fastwire.carriere.hibernate.daoimpl;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.fastwire.carriere.dao.DAOException;
import com.fastwire.carriere.dao.SiteDao;
import com.fastwire.carriere.inventory.entity.Site;
import com.fastwire.carriere.serviceorder.entity.ServiceOrder;

public class SiteDaoImpl extends AbstractDAOImpl implements SiteDao {

	@Override
	public Site getSitebyName(String siteName) throws DAOException {

		DetachedCriteria criteria = DetachedCriteria
				.forClass(ServiceOrder.class);
		criteria.add(Restrictions.eq("name", siteName));
		return (Site) getHibernateTemplate().findSingleObjByCriteria(criteria,
				false, false);

	}
}
